<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>
        // - 编写一个函数，计算三个数字的大小，按从小到大顺序输出
        var num1 = prompt('请输入数字') - 0
        var num2 = prompt('请输入数字') - 0
        var num3 = prompt('请输入数字') - 0
        fn(num1, num2, num3)

        function fn(num1, num2, num3) {
            var a = 0; //声明一个变量为换位置作中介
            if (num1 > num2) {
                a = num2; //将num2的值赋给声明作为中介的变量
                num2 = num1; //将num1的值赋给num2
                num1 = a; //再将赋在a(中介)上的num2的值给num1
            }
            if (num2 > num3) {
                a = num3;
                num3 = num2;
                num2 = a;
            }
            if (num1 > num2) {
                a = num2;
                num2 = num1;
                num1 = a;
            }
            document.write(num1 + "<", num2 + "<", num3);
        }
    </script>
</body>

</html>